/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package org.sbbs.admin.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import org.sbbs.base.jpa.entity.BaseEntity;
import org.springframework.security.core.GrantedAuthority;

/**
 *
 * @author jenkins
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "sys_role")
@Comment("系统角色")
public class SysRole extends BaseEntity implements GrantedAuthority {

    private static final long serialVersionUID = 7646223484785605014L;
    @Comment("名称")
    @Column(name = "name", length = 50)
    @NotNull
    private String name;
    @Comment("KEY")
    @Column(name = "key_", length = 50, unique = true)
    @NotNull
    private String key;

    @Override
    public String getAuthority() {
        return this.key;
    }

}
